package common.store.admin.service.impl;

import common.store.admin.dao.CategoryDao;
import common.store.admin.dao.SupplierDao;
import common.store.admin.service.SupplierService;
import common.store.web.bean.Supplier;

import java.util.List;
import java.util.Random;
import java.util.UUID;

public class SupplierServiceImpl  implements SupplierService {

   private  SupplierDao supplierDao;

   public SupplierServiceImpl(){
        supplierDao = new SupplierDao();
    }

    @Override
    public List<Supplier> getSupplierList() {
        return supplierDao.getSupplierList();
    }

    @Override
    public Integer delCategoryBySid(String sid) {
        return supplierDao.delBySid(sid);
    }

    @Override
    public Supplier getSupplierBySid(String sid) {
        return supplierDao.getSupplierBySid(sid);
    }

    @Override
    public Integer addSupplier(String sName) {
        Supplier supplier = new Supplier();
        supplier.setsName(sName);
        Random random=new Random();
        supplier.setSid(random.nextInt(1000));
        return supplierDao.addSupplier(supplier);
    }

    @Override
    public Integer updateSupplier(String sid, String sName) {
        return supplierDao.updateSupplier(sid,sName);
    }


}
